import React, { useEffect, useState } from 'react'
import { Action, SearchForm, TableCard } from "components";
import { Table, Select, Input, Button, message, Tag, Popconfirm, Modal } from 'antd';
import { getCommand } from "./service";
const Abnormal = () => {


  useEffect(() => {
    Getdata();
  }, []);



  const [dataSource, setDataSource] = useState([]);

  const [isFetching, setIsFetching] = useState(false);

  const [Total, setTotal] = useState(0);

  const [SearchParams, setSearchParams] = useState({
    current: 1,
    pageSize: 10,
    e3_exception_status: "2"
  });

  const Getdata = () => {
    setIsFetching(true);
    getCommand(SearchParams).then(({ data }) => {
      console.log(data)
      setDataSource(data.list)
      setTotal(data.total)
      setIsFetching(false);
    });
  };

  return (
    <div>
      <TableCard
        loading={isFetching}
        rowKey="id"
        dataSource={dataSource}
        onReload={Getdata}



        pagination={{
          showSizeChanger: true,
          showLessItems: true,
          showTotal: total => `共 ${Total} 条`,
          total: Total,
          current: SearchParams.page,
          pageSizeOptions: ['10', '20', '50', '100']
        }}
      >
        <Table.Column title="管理区" dataIndex="area_name" />
        <Table.Column title="物理区号" dataIndex="physical_zone" />
        <Table.Column title="用户类型" dataIndex="locker_user_type" />
        <Table.Column title="柜号" dataIndex="locker_number" />
        <Table.Column title="锁类型" dataIndex="locker_type" />
        
      </TableCard>
    </div>
  )
}

export default Abnormal